<template>
  <view>
    <!-- #ifdef MP -->
    <Dialog ref="dialog" />
    <!-- #endif -->
  </view>
</template>

<script setup>
// #ifdef MP
import { ref, onMounted, onUnmounted } from 'vue'
import { refRouteKey, refMessageObj, addRefObj, removeRefObj } from './ref'
import Dialog from './dialog'

const dialog = ref<any>(null)

onMounted(() => {
  addRef()
})

onUnmounted(() => {
  removeRefObj()
})

const addRef = () => {
  let refKey = refRouteKey()
  let refObj = refMessageObj()
  if (refKey.length > 0 && refObj[refKey] !== undefined) {
    return
  }
  dialog.value.route_uid = refKey
  addRefObj('dialog', dialog.value)
}
// #endif
</script>

<style lang="scss" scoped></style>
